package com.silence.ByteDance;

// 完美整数
public class easy_67 {
    public static int solution(int x, int y) {
        // Edit your code here
        if (y <= 10) {
            return y - x;
        } else {
            int sum = 0;
            for (int i = x; i <= y; i++) {
                if (i < 10) {
                    sum++;
                } else {
                    char[] i_char_list = String.valueOf(i).toCharArray();
                    boolean jug = true;
                    for (int j = 0; j < i_char_list.length-1; j++) {
                        if(i_char_list[j] != i_char_list[j+1]){
                            jug = false;
                        }
                    }
                    if(jug){
                        sum++;
                    }
                }
            }
            return sum;
        }
    }

    public static void main(String[] args) {
        // Add your test cases here

        System.out.println(solution(1, 10) == 9);
        System.out.println(solution(2, 22) == 10);
    }
}
